$OpenBSD: patch-Makefile,v 1.1.1.1 2007/11/20 21:08:56 jasper Exp $
--- Makefile.orig	Tue Oct 18 02:41:01 2005
+++ Makefile	Mon Nov 12 19:40:55 2007
@@ -10,13 +10,11 @@
 # debugging
 # DFLAGS = -DTEST -DDEBUG
 DFLAGS = -DGAPING_SECURITY_HOLE
-CFLAGS = -O
 XFLAGS = 	# xtra cflags, set by systype targets
 XLIBS =		# xtra libs if necessary?
 # -Bstatic for sunos,  -static for gcc, etc.  You want this, trust me.
 STATIC =
-CC = cc $(CFLAGS)
-LD = $(CC) -s	# linker; defaults to stripped executables
+LD = $(CXX)	# linker
 o = o		# object extension
 
 ALL = cryptcat
@@ -28,9 +26,12 @@ bogus:
 
 ### HARD TARGETS
 
-cryptcat:	netcat.c farm9crypt.o twofish2.o
-	$(LD) $(DFLAGS) $(XFLAGS) $(STATIC) -o cryptcat netcat.c farm9crypt.o twofish2.o $(XLIBS)
+netcat.o:
+	$(CC) $(CFLAGS) -c netcat.c
 
+cryptcat:      netcat.o farm9crypt.o twofish2.o
+	$(LD) $(CFLAGS) $(DFLAGS) $(XFLAGS) $(STATIC) -o cryptcat netcat.o farm9crypt.o twofish2.o $(XLIBS)
+
 nc-dos:
 	@echo "DOS?!  Maybe someday, but not now"
 
@@ -92,8 +93,11 @@ bsdi:
 netbsd:
 	make -e $(ALL) $(MFLAGS) XFLAGS='-DNETBSD' STATIC=-static \
 	XLIBS='-lstdc++'
+
 openbsd:
-	@echo "use: make netbsd"
+	${MAKE} -e $(ALL) $(MFLAGS) XFLAGS='-DNETBSD' STATIC=-static \
+	XLIBS='-lstdc++'
+
 # finally got to an hpux box, which turns out to be *really* warped. 
 # STATIC here means "linker subprocess gets args '-a archive'" which causes
 # /lib/libc.a to be searched ahead of '-a shared', or /lib/libc.sl.
@@ -115,10 +119,10 @@ next:
 	make -e $(ALL) $(MFLAGS) XFLAGS='-DNEXT' STATIC=-Bstatic
 
 farm9crypt.o: farm9crypt.cc farm9crypt.h
-		${CC} -c farm9crypt.cc
+		${CC} ${CFLAGS} -c farm9crypt.cc
 
 twofish2.o: twofish2.cc twofish2.h
-		${CC} -c twofish2.cc
+		${CC} ${CFLAGS} -c twofish2.cc
 
 # start with this for a new architecture, and see what breaks.
 generic:
